﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace PongXNA
{
    class Racket
    {
        public Racket(Texture2D texture2d )
        {
            SpriteRacket = texture2d;
        }
        public void RacketInit(/*Vector2 vectorposition,*/Rectangle hitbox, int taille)
        {
            
            HitBox = hitbox;
            if (hitbox.X == 0)
            {
                HitBox = new Rectangle(HitBox.X, HitBox.Y, HitBox.Width * taille, HitBox.Height * taille);
            }
            else
            {
                HitBox = new Rectangle(HitBox.X - SpriteRacket.Width * (taille - 1), HitBox.Y - SpriteRacket.Height * (taille - 1), HitBox.Width * taille, HitBox.Height * taille);
            }
            
            
        }
        private Rectangle _hitbox; // we need to have a hitbox for testing if an object touch them
        public Rectangle HitBox
        {
            get { return _hitbox; }
            set { _hitbox = value; }
        }

        private Vector2 _vectorposition;// we need to have a position for the Racket
        public Vector2 VectorPosition
        {
            get { return _vectorposition; }
            set { _vectorposition = value; }
        }

        private Texture2D _spriteracket;
        public Texture2D SpriteRacket
        {
            get { return _spriteracket; }
            set { _spriteracket = value; }
        }

        private int _currentscore;
        public int CurrentScore
        {
            get { return _currentscore; }
            set { _currentscore = value; }
        }

        private string _etat;
        public string Etat
        {
            get { return _etat; }
            set { _etat = value; }
        }

        public void BougerRacket(int x, int y)
        {
            HitBox = new Rectangle(x,y, HitBox.Width, HitBox.Height);
        }
        public void BougerRacket(int x,int y,int ms)
        {
            for (int i = HitBox.X; i < x; i--)
            {
                HitBox = new Rectangle(x, y, HitBox.Width, HitBox.Height);
            }
                
        }
        


        
        
        
    }
}
